
import 'package:flutter_ncsjqz_getx/http/dio_service.dart';
import 'package:flutter_ncsjqz_getx/model/base_entity.dart';
import 'package:flutter_ncsjqz_getx/model/user_detail_entity.dart';
import 'package:flutter_ncsjqz_getx/util/7niu_util.dart';
import 'package:flutter_ncsjqz_getx/util/toast_util.dart';
import 'package:package_get/base_logic.dart';

class UserInfoSettingLogic extends BaseLogic {
  UserDetailData? userDetailData;


  // "userName": "阿里路亚",
  // "passWord": "aa123456",
  // "telPhone": "15766835285",
  // "location": "北京",
  // "sex": 0,
  // "birthYear": "2000",
  // "birthMonth": "05",
  // "birthDay": "01",
  // "birth": "2000-05-01",
  // "nickName": "阿里路亚",
  // "userMail": null,
  // "userPic": "http://pic1.win4000.com/tj/2017-12-07/5a28b69334087.jpg",
  Future<BaseEntity> setUserInfo(Map<String,dynamic> map) async{
    BaseEntity data = await DioService<BaseEntity>().updateUserInfo(map);
    if(data.code == 0) toast("保存成功");
    update();
    return data;
  }

  Future<Null> uploadFile(path) async{
    await Niu7Util.instance!.upload(path,onUrl: (v){
      userDetailData!.userPic = v;
    });
    update();
  }
}